<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.sql.*" %>
<html>
<head>
    <title>delete</title>
</head>
<body>
<%
    //根据传过来的ID进行数据删除
    String id = request.getParameter("id");

    Connection conn = (Connection)session.getAttribute("Connection");
    String sql = "delete from material where id=" + id;
    PreparedStatement preparedStatement = conn.prepareStatement(sql);
    int res = preparedStatement.executeUpdate();
    System.out.print(sql);
    if (res > 0) {
        out.println("删除数据成功");
        //String url_next = "material_list.jsp?page=" + curpage + "&name=" + name + "&worknumber=" + worknumber + "&department=" + department + "&worktime=" + worktime + "&profession=" + profession;
        request.getRequestDispatcher("material_list.jsp").forward(request, response);
    } else {
        out.println("删除数据失败");
        response.setHeader("refresh", "3;material_list.jsp");
    }

%>
</body>
</html>
